package com.tool.btn;

import com.tool.image.ImageMixDeal;
import com.tool.role.RoleData;
import com.tool.tcp.Sprite;
import com.updateNew.MyIsif;
import org.come.Frame.MountShouhuJframe;
import org.come.Frame.ZhuFrame;
import org.come.Jpanel.MountShouhuJpanel;
import org.come.MountShouHu.*;
import org.come.bean.LoginResult;
import org.come.bean.SuitOperBean;
import org.come.entity.Goodstable;
import org.come.entity.Mount;
import org.come.mouslisten.GoodsMouslisten;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.*;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;


public class MountShouhuBtn extends MoBanBtn {
    int caozuo;
    MountShouhuJpanel mountShouhuJpanel;
    xuanzeJpanel xuanzeJpanel;
    RandFJpanel randFJpanel;
    LvlupJpanel lvlupJpanel;
    ShouhuPackJpanel shouhuPackJpanel;
    private Sprite sprite;

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, LvlupJpanel lvlupJpanel) {
        super(iconpath, type);
        this.caozuo = caozuo;
        this.lvlupJpanel = lvlupJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, ShouhuPackJpanel shouhuPackJpanel) {
        super(iconpath, type);
        this.caozuo = caozuo;
        this.shouhuPackJpanel = shouhuPackJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, MountShouhuJpanel mountShouhuJpanel) {
        super(iconpath, type);
        this.caozuo = caozuo;
        this.mountShouhuJpanel = mountShouhuJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, MountShouhuJpanel mountShouhuJpanel, Sprite sprite, int sx, int sy, boolean is) {
        super(iconpath, type, sprite, sx, sy, is);
        this.caozuo = caozuo;
        this.mountShouhuJpanel = mountShouhuJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, String text, Color[] colors, Font font, xuanzeJpanel xuanzeJpanel) {
        super(iconpath, type, colors);
        this.setText(text);
        this.setFont(font);
        this.setVerticalTextPosition(0);
        this.setHorizontalTextPosition(0);
        this.caozuo = caozuo;
        this.xuanzeJpanel = xuanzeJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, String text, Color[] colors, Font font, MountShouhuJpanel mountShouhuJpanel) {
        super(iconpath, type, colors);
        this.setText(text);
        this.setFont(font);
        this.setVerticalTextPosition(0);
        this.setHorizontalTextPosition(0);
        this.caozuo = caozuo;
        this.mountShouhuJpanel = mountShouhuJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, String text, Color[] colors, Font font, LvlupJpanel lvlupJpanel) {
        super(iconpath, type, colors);
        this.setText(text);
        this.setFont(font);
        this.setVerticalTextPosition(0);
        this.setHorizontalTextPosition(0);
        this.caozuo = caozuo;
        this.lvlupJpanel = lvlupJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, String text, Color[] colors, Font font, RandFJpanel randFJpanel) {
        super(iconpath, type, colors);
        this.setText(text);
        this.setFont(font);
        this.setVerticalTextPosition(0);
        this.setHorizontalTextPosition(0);
        this.caozuo = caozuo;
        this.randFJpanel = randFJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type, final int caozuo, RandFJpanel randFJpanel) {
        super(iconpath, type);
        this.caozuo = caozuo;
        this.randFJpanel = randFJpanel;
    }

    public MountShouhuBtn(final String iconpath, final int type) {
        super(iconpath, type);

    }

    @Override
    public void chooseyes() {

    }

    @Override
    public void chooseno() {

    }

    @Override
    public void nochoose(MouseEvent p0) {
        try {
            System.out.println(caozuo);
            switch (caozuo) {
                case 0:
                    mountShouhuJpanel.getQinglong().setIcons(CutButtonImage.cuts("inkImg/Client/青龙_选中.png"));
                    mountShouhuJpanel.getBaihu().setIcons(CutButtonImage.cuts("inkImg/Client/白虎_未选中.png"));
                    mountShouhuJpanel.getXuanwu().setIcons(CutButtonImage.cuts("inkImg/Client/玄武_未选中.png"));
                    mountShouhuJpanel.getZhuque().setIcons(CutButtonImage.cuts("inkImg/Client/朱雀_未选中.png"));
                    mountShouhuJpanel.getZhongtian().setIcons(CutButtonImage.cuts("inkImg/Client/中天_未选中.png"));
                    mountShouhuJpanel.setIco(new ImageIcon("inkImg/Client/四象背景.png"));
                    mountShouhuJpanel.getSixiang1().setVisible(true);
                    mountShouhuJpanel.getSixiang2().setVisible(true);
                    mountShouhuJpanel.setXuanzhong(1);
                    mountShouhuJpanel.shou();
                    mountShouhuJpanel.getQinglong().setIschoose(true);
                    mountShouhuJpanel.getZhongtian().setIschoose(false);
                    mountShouhuJpanel.getBaihu().setIschoose(false);
                    mountShouhuJpanel.getXuanwu().setIschoose(false);
                    mountShouhuJpanel.getZhuque().setIschoose(false);
                    break;
                case 1:
                    mountShouhuJpanel.getQinglong().setIcons(CutButtonImage.cuts("inkImg/Client/青龙_未选中.png"));
                    mountShouhuJpanel.getBaihu().setIcons(CutButtonImage.cuts("inkImg/Client/白虎_未选中.png"));
                    mountShouhuJpanel.getXuanwu().setIcons(CutButtonImage.cuts("inkImg/Client/玄武_选中.png"));
                    mountShouhuJpanel.getZhuque().setIcons(CutButtonImage.cuts("inkImg/Client/朱雀_未选中.png"));
                    mountShouhuJpanel.getZhongtian().setIcons(CutButtonImage.cuts("inkImg/Client/中天_未选中.png"));
                    mountShouhuJpanel.setIco(new ImageIcon("inkImg/Client/四象背景.png"));
                    mountShouhuJpanel.getSixiang1().setVisible(true);
                    mountShouhuJpanel.getSixiang2().setVisible(true);
                    mountShouhuJpanel.setXuanzhong(3);
                    mountShouhuJpanel.shou();
                    mountShouhuJpanel.getQinglong().setIschoose(false);
                    mountShouhuJpanel.getZhongtian().setIschoose(false);
                    mountShouhuJpanel.getBaihu().setIschoose(false);
                    mountShouhuJpanel.getXuanwu().setIschoose(true);
                    mountShouhuJpanel.getZhuque().setIschoose(false);
                    break;
                case 2:
                    mountShouhuJpanel.getQinglong().setIcons(CutButtonImage.cuts("inkImg/Client/青龙_未选中.png"));
                    mountShouhuJpanel.getBaihu().setIcons(CutButtonImage.cuts("inkImg/Client/白虎_未选中.png"));
                    mountShouhuJpanel.getXuanwu().setIcons(CutButtonImage.cuts("inkImg/Client/玄武_未选中.png"));
                    mountShouhuJpanel.getZhuque().setIcons(CutButtonImage.cuts("inkImg/Client/朱雀_选中.png"));
                    mountShouhuJpanel.getZhongtian().setIcons(CutButtonImage.cuts("inkImg/Client/中天_未选中.png"));
                    mountShouhuJpanel.setIco(new ImageIcon("inkImg/Client/四象背景.png"));
                    mountShouhuJpanel.getSixiang1().setVisible(true);
                    mountShouhuJpanel.getSixiang2().setVisible(true);
                    mountShouhuJpanel.setXuanzhong(4);
                    mountShouhuJpanel.shou();
                    mountShouhuJpanel.getQinglong().setIschoose(false);
                    mountShouhuJpanel.getZhongtian().setIschoose(false);
                    mountShouhuJpanel.getBaihu().setIschoose(false);
                    mountShouhuJpanel.getXuanwu().setIschoose(false);
                    mountShouhuJpanel.getZhuque().setIschoose(true);
                    break;
                case 3:
                    mountShouhuJpanel.getQinglong().setIcons(CutButtonImage.cuts("inkImg/Client/青龙_未选中.png"));
                    mountShouhuJpanel.getBaihu().setIcons(CutButtonImage.cuts("inkImg/Client/白虎_选中.png"));
                    mountShouhuJpanel.getXuanwu().setIcons(CutButtonImage.cuts("inkImg/Client/玄武_未选中.png"));
                    mountShouhuJpanel.getZhuque().setIcons(CutButtonImage.cuts("inkImg/Client/朱雀_未选中.png"));
                    mountShouhuJpanel.getZhongtian().setIcons(CutButtonImage.cuts("inkImg/Client/中天_未选中.png"));
                    mountShouhuJpanel.setIco(new ImageIcon("inkImg/Client/四象背景.png"));
                    mountShouhuJpanel.getSixiang1().setVisible(true);
                    mountShouhuJpanel.getSixiang2().setVisible(true);
                    mountShouhuJpanel.setXuanzhong(2);
                    mountShouhuJpanel.shou();
                    mountShouhuJpanel.getQinglong().setIschoose(false);
                    mountShouhuJpanel.getZhongtian().setIschoose(false);
                    mountShouhuJpanel.getBaihu().setIschoose(true);
                    mountShouhuJpanel.getXuanwu().setIschoose(false);
                    mountShouhuJpanel.getZhuque().setIschoose(false);
                    break;
                case 4:
                    mountShouhuJpanel.getQinglong().setIcons(CutButtonImage.cuts("inkImg/Client/青龙_未选中.png"));
                    mountShouhuJpanel.getBaihu().setIcons(CutButtonImage.cuts("inkImg/Client/白虎_未选中.png"));
                    mountShouhuJpanel.getXuanwu().setIcons(CutButtonImage.cuts("inkImg/Client/玄武_未选中.png"));
                    mountShouhuJpanel.getZhuque().setIcons(CutButtonImage.cuts("inkImg/Client/朱雀_未选中.png"));
                    mountShouhuJpanel.getZhongtian().setIcons(CutButtonImage.cuts("inkImg/Client/中天_选中.png"));
                    mountShouhuJpanel.setIco(new ImageIcon("inkImg/Client/守护背景.png"));
                    mountShouhuJpanel.getSixiang1().setVisible(false);
                    mountShouhuJpanel.getSixiang2().setVisible(false);
                    mountShouhuJpanel.setXuanzhong(0);
                    mountShouhuJpanel.shou();
                    mountShouhuJpanel.getQinglong().setIschoose(false);
                    mountShouhuJpanel.getZhongtian().setIschoose(true);
                    mountShouhuJpanel.getBaihu().setIschoose(false);
                    mountShouhuJpanel.getXuanwu().setIschoose(false);
                    mountShouhuJpanel.getZhuque().setIschoose(false);

                    break;
                case 5://坐骑面板确认按钮
                    MountShouhuJpanel mountShouhuJpanel = MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel();
                    if (mountShouhuJpanel == null) return;
                    LoginResult loginResult = RoleData.getRoleData().getLoginResult();
                    if (loginResult.getGold().longValue() < 300000) {
                        ZhuFrame.getZhuJpanel().addPrompt("金钱不足");
                        return;
                    }
                    if (MyMountRenderer.select != -1 && mountShouhuJpanel.getXuanzhong() != 0 && mountShouhuJpanel.SX != -1) {
                        String name = UserMessUntil.getMountlsit().get(MyMountRenderer.select).getMountname();
                        if (loginResult.getZhongtian() == null) {
                            ZhuFrame.getZhuJpanel().addPrompt("请先升级一下等级");
                            return;
                        }
                        String mes2[] = loginResult.getZhongtian().split("\\|")[2].split("\\*");
                        if (UserMessUntil.getMountlsit().get(MyMountRenderer.select).getSh() != 0) {
                            ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                            return;
                        }
                        int l = 0;
                        if (name != null) {
                            if (name.contains("一")) {
                                if (loginResult.getZhongtian() != null && Integer.parseInt(mes2[0]) == 1 || Integer.parseInt(mes2[1]) == 1) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                setsixiang(mountShouhuJpanel, 1, mountShouhuJpanel.SX);
                                l = 1;
                            } else if (name.contains("二")) {
                                if (loginResult.getZhongtian() != null && loginResult.getZhongtian().split("\\|")[2].contains("2")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                setsixiang(mountShouhuJpanel, 2, mountShouhuJpanel.SX);
                                l = 2;
                            } else if (name.contains("三")) {
                                if (loginResult.getZhongtian() != null && loginResult.getZhongtian().split("\\|")[2].contains("3")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                setsixiang(mountShouhuJpanel, 3, mountShouhuJpanel.SX);
                                l = 3;
                            } else if (name.contains("四")) {
                                if (loginResult.getZhongtian() != null && loginResult.getZhongtian().split("\\|")[2].contains("4")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                setsixiang(mountShouhuJpanel, 4, mountShouhuJpanel.SX);
                                l = 4;
                            } else if (name.contains("五")) {
                                if (loginResult.getZhongtian() != null && loginResult.getZhongtian().split("\\|")[2].contains("5")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                setsixiang(mountShouhuJpanel, 5, mountShouhuJpanel.SX);
                                l = 5;
                            } else if (name.contains("六")) {
                                if (loginResult.getZhongtian() != null && loginResult.getZhongtian().split("\\|")[2].contains("6")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                setsixiang(mountShouhuJpanel, 6, mountShouhuJpanel.SX);
                                l = 6;
                            } else if (name.contains("七")) {
                                if (loginResult.getZhongtian() != null && loginResult.getZhongtian().split("\\|")[2].contains("7")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                setsixiang(mountShouhuJpanel, 7, mountShouhuJpanel.SX);
                                l = 7;
                            }
                            if (mountShouhuJpanel.SX == 1) {
                                mountShouhuJpanel.getSixiang1().setBounds(360, 142, 60, 60);
                                if (loginResult.getSh() == null) {
                                    loginResult.setSh("0-0-0|0-0-0|0-0-0|0-0-0");
                                }
                                String[] m = loginResult.getSh().split("\\|");
                                m[mountShouhuJpanel.getXuanzhong() - 1] = m[mountShouhuJpanel.getXuanzhong() - 1].split("-")[0] + "-" + l + "-" + m[mountShouhuJpanel.getXuanzhong() - 1].split("-")[2];
                                loginResult.setSh(m[0] + "|" + m[1] + "|" + m[2] + "|" + m[3]);
                            } else {
                                mountShouhuJpanel.getSixiang2().setBounds(580, 142, 60, 60);
                                if (loginResult.getSh() == null) {
                                    loginResult.setSh("0-0-0|0-0-0|0-0-0|0-0-0");
                                }
                                String[] m = loginResult.getSh().split("\\|");
                                m[mountShouhuJpanel.getXuanzhong() - 1] = m[mountShouhuJpanel.getXuanzhong() - 1].split("-")[0] + "-" + m[mountShouhuJpanel.getXuanzhong() - 1].split("-")[1] + "-" + l;
                                loginResult.setSh(m[0] + "|" + m[1] + "|" + m[2] + "|" + m[3]);
                            }
                        }

                        if (loginResult.getZhongtian() != null) {
                            String[] mes = loginResult.getZhongtian().split("\\|");
                            if (mountShouhuJpanel.SX == 1)
                                mes[2] = l + "*" + mes[2].split("\\*")[1];
                            else mes[2] = mes[2].split("\\*")[0] + "*" + l;
                            loginResult.setZhongtian(mes[0] + "|" + mes[1] + "|" + mes[2]);
                        } else loginResult.setZhongtian("-1|-1|" + (mountShouhuJpanel.SX == 1 ? l + "*-1" : "-1*" + l));
                        mountShouhuJpanel.shouHu.setZhongtianmount(loginResult.getZhongtian().split("\\|")[2]);
                        SendMessageUntil.toServer(Agreement.getAgreement().shouhuAgreement(GsonUtil.getGsonUtil().getgson().toJson(mountShouhuJpanel.shouHu)));
                        UserMessUntil.getMountlsit().get(MyMountRenderer.select).setSh(mountShouhuJpanel.getXuanzhong());
                        String sendmes1 = Agreement.getAgreement().changeMountValue(GsonUtil.getGsonUtil().getgson().toJson(UserMessUntil.getMountlsit().get(MyMountRenderer.select)));
                        SendMessageUntil.toServer(sendmes1);
                        sendmes1 = Agreement.getAgreement().rolechangeAgreement("TT&" + loginResult.getSh());
                        SendMessageUntil.toServer(sendmes1);
                    } else if (mountShouhuJpanel.zuoqi != -1) {
                        String[] mes = RoleData.getRoleData().getLoginResult().getJiesuo().split("\\|");
                        String name = UserMessUntil.getMountlsit().get(MyMountRenderer.select).getMountname();
                        String m = null;
                        if (name != null) {
                            if (name.contains("一")) {
                                if (Integer.parseInt(mes[0]) == 1 || Integer.parseInt(mes[1]) == 1 || Integer.parseInt(mes[2]) == 1 || Integer.parseInt(mes[3]) == 1 || Integer.parseInt(mes[4]) == 1 || Integer.parseInt(mes[5]) == 1 || Integer.parseInt(mes[6]) == 1) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                mountShouhuJpanel.sixiang[mountShouhuJpanel.zuoqi - 1].setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + "1.png"));
                                m = 1 + "";
                            } else if (name.contains("二")) {
                                if (RoleData.getRoleData().getLoginResult().getJiesuo().contains("2")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                mountShouhuJpanel.sixiang[mountShouhuJpanel.zuoqi - 1].setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + "2.png"));
                                m = 2 + "";
                            } else if (name.contains("三")) {
                                if (RoleData.getRoleData().getLoginResult().getJiesuo().contains("3")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                mountShouhuJpanel.sixiang[mountShouhuJpanel.zuoqi - 1].setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + "3.png"));
                                m = 3 + "";
                            } else if (name.contains("四")) {
                                if (RoleData.getRoleData().getLoginResult().getJiesuo().contains("4")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                mountShouhuJpanel.sixiang[mountShouhuJpanel.zuoqi - 1].setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + "4.png"));
                                m = 4 + "";
                            } else if (name.contains("五")) {
                                if (RoleData.getRoleData().getLoginResult().getJiesuo().contains("5")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                mountShouhuJpanel.sixiang[mountShouhuJpanel.zuoqi - 1].setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + "5.png"));
                                m = 5 + "";
                            } else if (name.contains("六")) {
                                if (RoleData.getRoleData().getLoginResult().getJiesuo().contains("6")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                mountShouhuJpanel.sixiang[mountShouhuJpanel.zuoqi - 1].setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + "6.png"));
                                m = 6 + "";
                            } else if (name.contains("七")) {
                                if (RoleData.getRoleData().getLoginResult().getJiesuo().contains("7")) {
                                    ZhuFrame.getZhuJpanel().addPrompt("该坐骑已经被守护，请选择其他坐骑");
                                    return;
                                }
                                mountShouhuJpanel.sixiang[mountShouhuJpanel.zuoqi - 1].setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + "7.png"));
                                m = 7 + "";
                            }
                            //mountShouhuJpanel.getSixiang1().setBounds(360,142,60,60);
                        }
                        mes[mountShouhuJpanel.zuoqi - 1] = m;
                        RoleData.getRoleData().getLoginResult().setJiesuo(mes[0] + "|" + mes[1] + "|" + mes[2] + "|" + mes[3] + "|" + mes[4] + "|" + mes[5] + "|" + mes[6]);
                        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("Shouhu&" + RoleData.getRoleData().getLoginResult().getJiesuo()));
                        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("mon&" + 300000));
                        loginResult.setGold(BigDecimal.valueOf(loginResult.getGold().longValue() - 300000));

                    }
                    FormsManagement.HideForm(2255);
                    break;
                case 6://升级按钮
                    FormsManagement.showForm(2258);
                    break;
                case 7://附灵和熔炼
                    FormsManagement.showForm(2256);
                    break;
                case 8://选项卡1
                    randFJpanel.setType(1);
                    try {
                        String style = MyIsif.getStyle();
                        if ("水墨UI".equals(style)) {
                            randFJpanel.getXuanxiangka1().setIcons(CutButtonImage.cuts("inkImg/Client/选中按钮.png"));
                            randFJpanel.getXuanxiangka2().setIcons(CutButtonImage.cuts("inkImg/Client/未选中按钮.png"));
                        } else {
                            randFJpanel.getXuanxiangka1().setIcons(CutButtonImage.cuts("inkImg/hongmu/未选中按钮(1).png"));
                            randFJpanel.getXuanxiangka2().setIcons(CutButtonImage.cuts("inkImg/hongmu/未选中按钮(1).png"));
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    break;
                case 9://选项卡2
                    randFJpanel.setType(2);
                    try {
                        String style = MyIsif.getStyle();
                        if ("水墨UI".equals(style)) {
                            randFJpanel.getXuanxiangka1().setIcons(CutButtonImage.cuts("inkImg/Client/未选中按钮.png"));
                            randFJpanel.getXuanxiangka2().setIcons(CutButtonImage.cuts("inkImg/Client/选中按钮.png"));
                        } else {
                            randFJpanel.getXuanxiangka1().setIcons(CutButtonImage.cuts("inkImg/hongmu/未选中按钮(1).png"));
                            randFJpanel.getXuanxiangka2().setIcons(CutButtonImage.cuts("inkImg/hongmu/未选中按钮(1).png"));
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    break;
                case 10:
                    //  if (lvlupJpanel.getTishengdianshu())
                    int k = 0;
                    k = lvlupJpanel.getTishengdianshu() + 1;
                    if (k >= (lvlupJpanel.lvl + 1) * 6)
                        k = (lvlupJpanel.lvl + 1) * 6 - lvlupJpanel.xiuweidian;
                    lvlupJpanel.setTishengdianshu(k);
                    break;
                case 11:
                    if (lvlupJpanel.getTishengdianshu() >= 1) {
                        lvlupJpanel.setTishengdianshu(lvlupJpanel.getTishengdianshu() - 1);
                    }
                    break;
                case 12:
                    loginResult = RoleData.getRoleData().getLoginResult();
                    if (loginResult.getGold().longValue() - 10000000L < 0) {
                        ZhuFrame.getZhuJpanel().addPrompt("金钱不足");
                        return;
                    }
                    if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 0) {
                        if (loginResult.getQinglong() == null || loginResult.getZhuque() == null || loginResult.getBaihu() == null || loginResult.getXuanwu() == null) {
                            ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                            return;
                        } else {
                            if (Integer.parseInt(loginResult.getXuanwu().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }
                            if (Integer.parseInt(loginResult.getQinglong().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }
                            if (Integer.parseInt(loginResult.getZhuque().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }
                            if (Integer.parseInt(loginResult.getBaihu().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }

                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 1) {
                        if (loginResult.getQinglong() != null && Integer.parseInt(loginResult.getQinglong().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("青龙最高等级为24级");
                            return;
                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 2) {
                        if (loginResult.getBaihu() != null && Integer.parseInt(loginResult.getBaihu().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("白虎最高等级为24级");
                            return;
                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 3) {
                        if (loginResult.getXiuwei() != null && Integer.parseInt(loginResult.getXuanwu().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("玄武最高等级为24级");
                            return;
                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 4) {
                        if (loginResult.getZhuque() != null && Integer.parseInt(loginResult.getZhuque().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("朱雀最高等级为24级");
                            return;
                        }
                    }

                    if (lvlupJpanel.xiuweidian >= (lvlupJpanel.lvl + 1) * 6) {
                        lvlupJpanel.type = false;
                        lvlupJpanel.up.setVisible(false);
                        lvlupJpanel.down.setVisible(false);
                        lvlupJpanel.yijiantisheng.setVisible(false);
                        lvlupJpanel.tishengxiuweidian.setVisible(false);
                        lvlupJpanel.tupo.setVisible(true);


                    } else {
                        //lvlupJpanel.xiuweidian+=1;
                        int x = lvlupJpanel.xiuweidian + 1;
                        int l = lvlupJpanel.lvl;
                        ShouHu shouHu = new ShouHu();
                        if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 0) {
                            shouHu.setZhongtianxiuweidian(x);
                            shouHu.setZhongtianlvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 1) {
                            shouHu.setQinglongxiuweidian(x);
                            shouHu.setQinglonglvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 2) {
                            shouHu.setBaihuxiuweidian(x);
                            shouHu.setBaihulvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 3) {
                            shouHu.setXuanwuxiuweidian(x);
                            shouHu.setXuanwulvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 4) {
                            shouHu.setZhuquexiuweidian(x);
                            shouHu.setZhuquelvl(l);
                        }
                        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("mon&" + 10000000));
                        RoleData.getRoleData().getLoginResult().setGold(BigDecimal.valueOf(RoleData.getRoleData().getLoginResult().getGold().longValue() - 10000000));
                        final String sendmes = Agreement.getAgreement().shouhuAgreement(GsonUtil.getGsonUtil().getgson().toJson(shouHu));
                        SendMessageUntil.toServer(sendmes);
                    }
                    break;
                case 13:
                    loginResult = RoleData.getRoleData().getLoginResult();
                    if (loginResult.getGold().longValue() - 10000000L * lvlupJpanel.tishengdianshu < 0) {
                        ZhuFrame.getZhuJpanel().addPrompt("金钱不足");
                        return;
                    }
                    if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 0) {
                        if (loginResult.getQinglong() == null || loginResult.getZhuque() == null || loginResult.getBaihu() == null || loginResult.getXuanwu() == null) {
                            ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                            return;
                        } else {
                            if (Integer.parseInt(loginResult.getXuanwu().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }
                            if (Integer.parseInt(loginResult.getQinglong().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }
                            if (Integer.parseInt(loginResult.getZhuque().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }
                            if (Integer.parseInt(loginResult.getBaihu().split("\\|")[0]) <= Integer.parseInt(loginResult.getZhongtian().split("\\|")[0])) {
                                ZhuFrame.getZhuJpanel().addPrompt("中天等级不能超过四象等级的最低等级");
                                return;
                            }

                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 1) {
                        if (loginResult.getQinglong() != null && Integer.parseInt(loginResult.getQinglong().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("青龙最高等级为24级");
                            return;
                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 2) {
                        if (loginResult.getBaihu() != null && Integer.parseInt(loginResult.getBaihu().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("白虎最高等级为24级");
                            return;
                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 3) {
                        if (loginResult.getXiuwei() != null && Integer.parseInt(loginResult.getXuanwu().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("玄武最高等级为24级");
                            return;
                        }
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 4) {
                        if (loginResult.getZhuque() != null && Integer.parseInt(loginResult.getZhuque().split("\\|")[0]) >= 24) {
                            ZhuFrame.getZhuJpanel().addPrompt("朱雀最高等级为24级");
                            return;
                        }
                    }
                    if (lvlupJpanel.xiuweidian >= (lvlupJpanel.lvl + 1) * 6) {
                        lvlupJpanel.type = false;
                        lvlupJpanel.up.setVisible(false);
                        lvlupJpanel.down.setVisible(false);
                        lvlupJpanel.yijiantisheng.setVisible(false);
                        lvlupJpanel.tishengxiuweidian.setVisible(false);
                        lvlupJpanel.tupo.setVisible(true);
                    } else {
                        int x = lvlupJpanel.xiuweidian + lvlupJpanel.tishengdianshu;
                        int c = 0;
                        if (x > (lvlupJpanel.lvl + 1) * 6) {
                            x = (lvlupJpanel.lvl + 1) * 6;
                            c = x - lvlupJpanel.xiuweidian;
                        } else c = lvlupJpanel.tishengdianshu;

                        int l = lvlupJpanel.lvl;
                        ShouHu shouHu = new ShouHu();
                        if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 0) {
                            shouHu.setZhongtianxiuweidian(x);
                            shouHu.setZhongtianlvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 1) {
                            shouHu.setQinglongxiuweidian(x);
                            shouHu.setQinglonglvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 2) {
                            shouHu.setBaihuxiuweidian(x);
                            shouHu.setBaihulvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 3) {
                            shouHu.setXuanwuxiuweidian(x);
                            shouHu.setXuanwulvl(l);
                        } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 4) {
                            shouHu.setZhuquexiuweidian(x);
                            shouHu.setZhuquelvl(l);
                        }
                        long s = 10000000L * c;
                        if (loginResult.getGold().longValue() - s < 0) {
                            ZhuFrame.getZhuJpanel().addPrompt("金钱不足");
                            return;
                        }
                        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("mon&" + s));
                        RoleData.getRoleData().getLoginResult().setGold(BigDecimal.valueOf(loginResult.getGold().longValue() - (10000000L * c)));
                        final String sendmes = Agreement.getAgreement().shouhuAgreement(GsonUtil.getGsonUtil().getgson().toJson(shouHu));
                        SendMessageUntil.toServer(sendmes);
                    }
                    break;
                case 14:
                    Goodstable ltrGoods1 = getGoodType(2258);
                    int num1 = ltrGoods1 == null ? 0 : ltrGoods1.getUsetime();
                    if (num1 < (lvlupJpanel.lvl + 1) * 12 || ltrGoods1 == null) {
                        ZhuFrame.getZhuJpanel().addPrompt("灵元晶不足");
                        return;
                    }
                    ltrGoods1.goodxh((lvlupJpanel.lvl + 1) * 12);
                    num1 = ltrGoods1.getUsetime();
                    if (num1 <= 0) {
                        GoodsListFromServerUntil.shouhu(ltrGoods1.getRgid().intValue());
                    }
                    String kk = "jiesuo&" + (lvlupJpanel.lvl + 1) * 12 + "&" + ltrGoods1.getRgid();
                    SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement(kk));
                    lvlupJpanel.xiuweidian = 0;
                    lvlupJpanel.type = true;
                    lvlupJpanel.up.setVisible(true);
                    lvlupJpanel.down.setVisible(true);
                    lvlupJpanel.yijiantisheng.setVisible(true);
                    lvlupJpanel.tishengxiuweidian.setVisible(true);
                    lvlupJpanel.tupo.setVisible(false);
                    int x = lvlupJpanel.xiuweidian;
                    int l = lvlupJpanel.lvl + 1;
                    ShouHu shouHu = new ShouHu();
                    if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 0) {
                        shouHu.setZhongtianxiuweidian(x);
                        shouHu.setZhongtianlvl(l);
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 1) {
                        shouHu.setQinglongxiuweidian(x);
                        shouHu.setQinglonglvl(l);
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 2) {
                        shouHu.setBaihuxiuweidian(x);
                        shouHu.setBaihulvl(l);
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 3) {
                        shouHu.setXuanwuxiuweidian(x);
                        shouHu.setXuanwulvl(l);
                    } else if (MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().getXuanzhong() == 4) {
                        shouHu.setZhuquexiuweidian(x);
                        shouHu.setZhuquelvl(l);
                    }
                    final String sendmes = Agreement.getAgreement().shouhuAgreement(GsonUtil.getGsonUtil().getgson().toJson(shouHu));
                    SendMessageUntil.toServer(sendmes);
                    break;
                case 15://开始附灵
                    if (ImageMixDeal.userimg.getRoleShow().getBooth_id() != null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("摆摊状态不可以操作！");
                        return;
                    }
                    int i = 0;
                    i = (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().page == 0 ? 1 : ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().page) * ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getXuanzhong1();
                    if (i < 0 || ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().size() == 0)
                        return;
                    Goodstable goodstable = ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().get(i);
                    Goodstable ltrGoods = getGoodType(2258);
                    int num = ltrGoods == null ? 0 : ltrGoods.getUsetime();
                    if (num <= 0) {
                        ZhuFrame.getZhuJpanel().addPrompt("元灵石不足");
                        return;
                    }
                    if (RoleData.getRoleData().getLoginResult().getGold().longValue() - 500000 < 0) {
                        ZhuFrame.getZhuJpanel().addPrompt("金钱不足");
                        return;
                    }
                    if (goodstable != null) {
                        final SuitOperBean operBean = new SuitOperBean();
                        List<BigDecimal> bigDecimals = new ArrayList<>();
                        bigDecimals.add(goodstable.getRgid());
                        bigDecimals.add(ltrGoods.getRgid());
                        operBean.setGoods(bigDecimals);
                        operBean.setType(2255);
                        ltrGoods.goodxh(1);
                        num = ltrGoods.getUsetime();
                        if (num <= 0) {
                            GoodsListFromServerUntil.shouhu(ltrGoods.getRgid().intValue());
                        }
                        String mm = "jiesuo&1&" + ltrGoods.getRgid();
                        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement(mm));
                        final String senmes = Agreement.suitOperateAgreement(GsonUtilsb.getGsonUtil().getgson().toJson(operBean));
                        SendMessageUntil.toServer(senmes);
                        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("mon&" + 500000));
                        RoleData.getRoleData().getLoginResult().setGold(BigDecimal.valueOf(RoleData.getRoleData().getLoginResult().getGold().longValue() - 500000));
                    } else ZhuFrame.getZhuJpanel().addPrompt("请选择守护石");
                    break;
                case 16://开始熔炼
                    if (ImageMixDeal.userimg.getRoleShow().getBooth_id() != null) {
                        ZhuFrame.getZhuJpanel().addPrompt2("摆摊状态不可以熔炼操作！");
                        return;
                    }
                    if (randFJpanel.RL1 == randFJpanel.RL2) {
                        ZhuFrame.getZhuJpanel().addPrompt("不可选择同一个守护石");
                        return;
                    }
                    if (randFJpanel.RL1.getValue().equals("")) {
                        ZhuFrame.getZhuJpanel().addPrompt("主守护石无属性");
                        return;
                    }
                    if (randFJpanel.RL2.getValue().equals("")) {
                        ZhuFrame.getZhuJpanel().addPrompt("副守护石无属性");
                        return;
                    }
                    if (RoleData.getRoleData().getLoginResult().getShouhu() < 50) {
                        ZhuFrame.getZhuJpanel().addPrompt("守护之尘不足");
                        return;
                    }
                    if (RoleData.getRoleData().getLoginResult().getGold().longValue() - 1000000 < 0) {
                        ZhuFrame.getZhuJpanel().addPrompt("金钱不足");
                        return;
                    }
                    if (randFJpanel.RL1 != null && randFJpanel.RL2 != null && !randFJpanel.RL1.getValue().equals("") && !randFJpanel.RL2.getValue().equals("")) {
                        final SuitOperBean operBean = new SuitOperBean();
                        List<BigDecimal> bigDecimals = new ArrayList<>();
                        bigDecimals.add(randFJpanel.RL1.getRgid());
                        bigDecimals.add(randFJpanel.RL2.getRgid());
                        operBean.setGoods(bigDecimals);
                        operBean.setType(2256);
                        RoleData.getRoleData().getLoginResult().setShouhu(RoleData.getRoleData().getLoginResult().getShouhu() - 50);
                        final String senmes = Agreement.suitOperateAgreement(GsonUtilsb.getGsonUtil().getgson().toJson(operBean));
                        SendMessageUntil.toServer(senmes);
                        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().setXuanzhong2(-1);
                        randFJpanel.RL2.setUsetime(0);
                        GoodsMouslisten.gooduse(randFJpanel.RL2, 1);
                        GoodsListFromServerUntil.shouhu(randFJpanel.RL2.getRgid().intValue());
                        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("mon&" + 1000000));
                        RoleData.getRoleData().getLoginResult().setGold(BigDecimal.valueOf(RoleData.getRoleData().getLoginResult().getGold().longValue() - 1000000));
                        GoodsMouslisten.goodreplace(-1, -1);
                        for (int c = 0; c <= ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().size() - 1; c++) {
                            if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().get(c) == randFJpanel.RL2) {
                                ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().set(c, null);
                            }
                        }

                    }
                    randFJpanel.RL2 = null;
                    break;
                case 17:
                case 19:
                case 20:
                    if (caozuo == 17) {
                        ShouhuPackJframe.getShouhuPackJframe().setLocation(200, 380);
                        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().init(1);
                    } else if (caozuo == 19) {
                        ShouhuPackJframe.getShouhuPackJframe().setLocation(200, 300);
                        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().init(1);
                    } else {
                        ShouhuPackJframe.getShouhuPackJframe().setLocation(500, 300);
                        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().init(2);
                    }

                    FormsManagement.showForm(2257);
                    break;
                case 21:
                    ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().setXuanzhong1(-1);
                    randFJpanel.FST.setVisible(true);
                    randFJpanel.img1.setVisible(false);
                    randFJpanel.FL = null;
                    break;
                case 23:
                    ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().setXuanzhong1(-1);
                    randFJpanel.RST1.setVisible(true);
                    randFJpanel.img3.setVisible(false);
                    ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().setXuanzhong2(-1);
                    randFJpanel.RST2.setVisible(true);
                    randFJpanel.img4.setVisible(false);
                    randFJpanel.RL1 = null;
                    randFJpanel.RL2 = null;
                    break;
                case 24:
                    ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().setXuanzhong2(-1);
                    randFJpanel.RST2.setVisible(true);
                    randFJpanel.img4.setVisible(false);
                    randFJpanel.RL2 = null;
                    break;

                case 50:
                case 51:
                case 52:
                case 53:
                case 54:
                case 55:
                case 56:

                    k = MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouHu.zhongtianlvl;
                    int v = caozuo - 50;
                    if (v == 0) {
                        if (k < 3) return;
                    } else if (v == 1) {
                        if (k < 6) return;
                    } else if (v == 2) {
                        if (k < 9) return;
                    } else if (v == 3) {
                        if (k < 12) return;
                    } else if (v == 4) {
                        if (k < 16) return;
                    } else if (v == 5) {
                        if (k < 20) return;
                    } else if (v == 6) {
                        if (k < 24) return;
                    }
                    jiesuo(p0, caozuo - 50);
                    break;
                case 60:
                case 61:
                case 62:
                case 63:
                case 64:
                case 65:
                case 66:
                    if (p0.getButton() == MouseEvent.BUTTON3) {
                        MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().shouhuBtn[caozuo - 60].setIcons(MountShouhuJpanel.imageIcons2);
                        List<Mount> list = UserMessUntil.getMountlsit();
                        if (RoleData.getRoleData().getLoginResult().getJiesuo() == null) {
                            return;
                        }
                        l = Integer.parseInt(RoleData.getRoleData().getLoginResult().getJiesuo().split("\\|")[caozuo - 60]);
                        if (l == -1) return;
                        for (int i1 = 0; i1 <= list.size() - 1; i1++) {
                            if (list.get(i1).getMountid() == l) {
                                for (int f = 0; f <= ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.size() - 1; f++) {
                                    if (ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.get(f).getRgid().intValue() == list.get(i1).getShouhu()) {
                                        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.get(f).setStatus(0);
                                        GoodsListFromServerUntil.newgood(ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.get(f));
                                        ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().getGoodstableList().add(ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.get(f));
                                        String sendmes2 = Agreement.getAgreement().rolechangeAgreement("up&" + GsonUtil.getGsonUtil().getgson().toJson(ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.get(f)));
                                        SendMessageUntil.toServer(sendmes2);
                                    }
                                }
                                int finalI = i1;

                                ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.removeIf(q -> q.getRgid().intValue() == list.get(finalI).getShouhu());
                                list.get(i1).setShouhu(0);

                                String sendmes1 = Agreement.getAgreement().changeMountValue(GsonUtil.getGsonUtil().getgson().toJson(list.get(i1)));
                                SendMessageUntil.toServer(sendmes1);
                            }
                        }
                        return;
                    }
                    MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().s = true;
                    MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().l = caozuo - 60;
                    FormsManagement.showForm(2257);
                    break;
                case 70:
                    if (shouhuPackJpanel.page < 4) {
                        shouhuPackJpanel.page += 1;
                    }
                    shouhuPackJpanel.updata();
                    break;
                case 71:
                    if (shouhuPackJpanel.page > 0) {
                        shouhuPackJpanel.page -= 1;
                    }
                    shouhuPackJpanel.updata();
                    break;


            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public static void jiesuo(MouseEvent p0, int i) {
        LoginResult loginResult = RoleData.getRoleData().getLoginResult();
        Goodstable ltrGoods = getGoodType(2258);
        int num = ltrGoods == null ? 0 : ltrGoods.getUsetime();
        if (p0.getButton() == MouseEvent.BUTTON3) {

            if (loginResult.getJiesuo() == null) {
                if (i != 0) {
                    ZhuFrame.getZhuJpanel().addPrompt("请先解锁第一栏位");
                    return;
                } else if (num < ((i + 1) * 3)) {
                    ZhuFrame.getZhuJpanel().addPrompt("灵元晶不足" + ((i + 1) * 3) + "个，请检查");
                    return;
                } else {
                    String kk = "jiesuo&" + ((i + 1) * 3) + "&" + ltrGoods.getRgid();
                    SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement(kk));
                    ltrGoods.goodxh(((i + 1) * 3));
                    num = ltrGoods.getUsetime();
                    if (num <= 0) {
                        GoodsListFromServerUntil.shouhu(ltrGoods.getRgid().intValue());
                    }
                    if (isv(1 - i * 0.15)) {
                        loginResult.setJiesuo("0|-1|-1|-1|-1|-1|-1");

                    } else {
                        ZhuFrame.getZhuJpanel().addPrompt("开启失败，请再接再励！");
                        return;
                    }
                    ;


                }

            } else if (loginResult.getJiesuo().split("\\|")[i].equals("-1")) {
                if (num == 0) {
                    ZhuFrame.getZhuJpanel().addPrompt("请先获取灵元晶");
                    return;
                }
                SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("jiesuo&" + ((i + 1) * 3)));
                ltrGoods.goodxh(((i + 1) * 3));
                num = ltrGoods.getUsetime();
                if (num <= 0) {
                    GoodsListFromServerUntil.shouhu(ltrGoods.getRgid().intValue());
                }
                if (isv(1 - i * 0.15)) {
                    String[] mes = loginResult.getJiesuo().split("\\|");
                    StringBuilder m = new StringBuilder();
                    for (int k = 0; k <= mes.length - 1; k++) {
                        if (k == i) {
                            m.append("0");
                        } else {
                            m.append(mes[k]);
                        }

                        if (k < mes.length - 1) {
                            m.append("|");
                        }
                    }
                    loginResult.setJiesuo(m.toString());

                } else {
                    ZhuFrame.getZhuJpanel().addPrompt("开启失败，请再接再励！");
                    return;
                }


            } else if (loginResult.getJiesuo().split("\\|")[i].equals("0")) {

                ZhuFrame.getZhuJpanel().addPrompt("栏位已解锁");
                return;

            } else {
                String[] mes = loginResult.getJiesuo().split("\\|");
                StringBuilder m = new StringBuilder();
                for (int k = 0; k <= mes.length - 1; k++) {
                    if (k == i) {
                        m.append("0");
                    } else {
                        m.append(mes[k]);
                    }

                    if (k < mes.length - 1) {
                        m.append("|");
                    }
                }
                loginResult.setJiesuo(m.toString());
            }

        } else if (p0.getButton() == MouseEvent.BUTTON1) {
            if (loginResult.getJiesuo() == null) {
                ZhuFrame.getZhuJpanel().addPrompt("请先解锁栏位");
                return;
            }
            if (loginResult.getJiesuo().split("\\|")[i].equals("-1")) {
                ZhuFrame.getZhuJpanel().addPrompt("请先解锁当前栏位栏位");
                return;
            }
            if (loginResult.getJiesuo().split("\\|")[i].equals("0")) {
                {
                    MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().zuoqi = i + 1;
                    FormsManagement.showForm(2255);
                }
            }

        } else {
            return;
        }
     /*   if (loginResult.getJiesuo()==null){
            String mes="-1";
            String mes1=0+"";
            StringBuilder jiesuo= new StringBuilder();
            for (int p=0;p<7;p++){
               if (p==i){
                   if (p==6)
                       jiesuo.append(mes1);
                   else jiesuo.append(mes).append("|");
               }else {
                   if (p==6)
                       jiesuo.append(mes);
                   else jiesuo.append(mes).append("|");
               }

            }
            loginResult.setJiesuo(jiesuo.toString());
        }else {
            String []mes=loginResult.getJiesuo().split("\\|");
            if (mes[i].equals("0")){
                if (p0.getButton() == MouseEvent.BUTTON1) {
                    MountShouhuJframe.getMountShouhuJframe().getMountShouhuJpanel().zuoqi=i+1;
                    FormsManagement.showForm(2255);
                }
            }else if (p0.getButton() == MouseEvent.BUTTON1){//开启


                StringBuilder m=new StringBuilder();
                for (int k=0;k<=mes.length-1;k++){
                    if (i==k){
                        if (k==mes.length-1){
                            m.append("0");
                        }else  m.append("0").append("|");
                    }else if (k==mes.length-1){
                        m.append(mes[k]);
                    }else m.append(mes[k]).append("|");


                }
                loginResult.setJiesuo(m.toString());
            }else if (p0.getButton() == MouseEvent.BUTTON3){//恢复
                StringBuilder m=new StringBuilder();
                for (int k=0;k<=mes.length-1;k++){
                    if (i==k){
                        if (k==mes.length-1){
                            m.append("0");
                        }else  m.append("0").append("|");
                    }else if (k==mes.length-1){
                        m.append(mes[k]);
                    }else m.append(mes[k]).append("|");


                }
                loginResult.setJiesuo(m.toString());
            }

        }*/
        SendMessageUntil.toServer(Agreement.getAgreement().rolechangeAgreement("Shouhu&" + loginResult.getJiesuo()));

    }

    public static ImageIcon getimage(int i) {
        return new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + i + ".png");
    }

    public static void setsixiang(MountShouhuJpanel mountShouhuJpanel, int i, int SX) {
        if (SX == 1)
            mountShouhuJpanel.getSixiang1().setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + i + ".png"));
        else if (SX == 2)
            mountShouhuJpanel.getSixiang2().setIcon(new ImageIcon("inkImg/Client/zqhead/50x50_" + Util.getRaceSting(ImageMixDeal.userimg.getRoleShow().getSpecies_id()) + i + ".png"));
    }

    /**
     * 概率判断
     */
    public static boolean isv(double successProbability) {
        // 设置成功的概率阈值（范围在0到1之间）

        // 生成一个0到1之间的随机数
        Random random = new Random();
        double randomValue = random.nextDouble();

        // 判断是否成功
        if (randomValue < successProbability) {
            return true;
        } else {
            return false;
        }
    }

    public static Goodstable getGoodType(long type) {
        Goodstable[] goodslist = GoodsListFromServerUntil.getGoodslist();
        Goodstable goodstable = null;
        int i = 0;

        for (int len = goodslist.length; i < len; ++i) {
            if (goodslist[i] != null && goodslist[i].getType() == type) {
                goodstable = goodslist[i];
                break;
            }
        }
        return goodstable;
    }
}
